package com.edu.service.impl;

import com.edu.bean.Like;
import com.edu.mapper.LikeMapper;
import com.edu.service.LikeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 75099637@qq.com
 * @PackageName SpringAndMybatis
 * @Package com.edu.service.impl
 * @Date 2023/11/14 21:20
 * @Version 1.0
 */
@Service
public class LikeServiceImpl implements LikeService {

    @Resource
    private LikeMapper likeMapper;
    @Override
    public int insertLike(Like like) {
        return likeMapper.insert(like);
    }

    @Override
    public int updateLike(Like like) {
        return likeMapper.updateByPrimaryKey(like);
    }

    @Override
    public int deleteLike(Integer userId) {
        return likeMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public List<Like> getLike() {
        return likeMapper.selectAll();
    }

    @Override
    public List<Like> getLikeByUserId(Integer userId) {
        return  likeMapper.selectByPrimaryKey(userId);
    }
}
